/**************************************************************
Arise Engine		Input.h

					E-mail:	arise_engine@mail.ru

created:			10.02.2007
last changes:		21.09.2008
**************************************************************/
#pragma once

#define DIRECTINPUT_VERSION 0x0800

#include <dinput.h>
#include "InputDevice.h"
#include "InputDeviceKeyboard.h"
#include "InputDeviceMouse.h"
#include "KeysDefine.h"
#include "KeyAction.h"


class Input
{
private:

	LPDIRECTINPUT8			m_dinput_device;
	InputDeviceKeyboard		m_keyboard;
	InputDeviceMouse		m_mouse;
	InputEvent				m_last_event;
	InputEvent				m_keyboard_event;
	std::vector<KeyAction>	m_key_actions;

public:
	Input();
	virtual ~Input();

	bool Init(HWND hWnd);
	void Update();
	bool IsKeyPressed(UINT key_id);
	bool IsKeyDown(UINT key_id);
	bool IsKeyUp(UINT key_id);
	void ReadImmediateData();
	void ReadBufferedData();
	void Release();
	void AddKeyAction(const KeyAction& key_action);
	void TestKey();
	void BuildEvent(INPUT_EVENT_TYPE type, int key, int scan);

	AxisData*		GetMouseAxisOffset()	{return m_mouse.GetAxisOffset();}
	InputEvent&		GetLastEvent()			{return m_last_event;}
	InputEvent&		GetUIEvent()			{return m_keyboard.GetUIEvent();}
};

